package com.reason.oauth;


import com.reason.common.interceptor.FeignInterceptor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.web.client.RestTemplate;

/**
 * 启动类
 */
@SpringBootApplication
@EnableFeignClients(basePackages = "com.reason.user.feign")//feign扫描
@EnableDiscoveryClient
public class OauthApplication {


    public static void main(String[] args){
        SpringApplication.run(OauthApplication.class, args);
    }


    /**
     * 注入restTemplate
     * @return
     */
    @Bean
    public RestTemplate gerRestTemplate(){
        return new RestTemplate();

    }

    /**
     * 注入feign的拦截器，对feign调用微服务携带bearer jwt头信息
     * @return
     */
    @Bean
    public FeignInterceptor getFeignInterceptor(){
        return new FeignInterceptor();

    }
}
